package mo.leetcode_top;

public class L11 {

    //每次都取最大
    public int maxArea(int[] height) {
        int i = 0;
        int j = height.length - 1;
        int max = 0;
        while (i < j) {
            max = Math.max(max, Math.min(height[i], height[j]) * (j-i));
            if (height[i] < height[j]) {
                i++;
            } else {
                j--;
            }
        }
        return max;
    }


    public static void main(String[] args) {
        L11 test = new L11();
        System.out.println(test.maxArea(new int[]{1,1}));
    }
}
